# -*- coding: utf-8 -*-

# Scrapy settings for iQiYiSpider project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
#     http://doc.scrapy.org/en/latest/topics/settings.html
#     http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
#     http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html

BOT_NAME = 'iQiYiSpider'

SPIDER_MODULES = ['iQiYiSpider.spiders']
NEWSPIDER_MODULE = 'iQiYiSpider.spiders'


# Crawl responsibly by identifying yourself (and your website) on the user-agent
#USER_AGENT = 'iQiYiSpider (+http://www.yourdomain.com)'

# Obey robots.txt rules
ROBOTSTXT_OBEY = False

# Configure maximum concurrent requests performed by Scrapy (default: 16)
CONCURRENT_REQUESTS = 100

# Configure a delay for requests for the same website (default: 0)
# See http://scrapy.readthedocs.org/en/latest/topics/settings.html#download-delay
# See also autothrottle settings and docs
#DOWNLOAD_DELAY = 3
# The download delay setting will honor only one of:
#CONCURRENT_REQUESTS_PER_DOMAIN = 16
#CONCURRENT_REQUESTS_PER_IP = 16

# Disable cookies (enabled by default)
#COOKIES_ENABLED = False

# Disable Telnet Console (enabled by default)
#TELNETCONSOLE_ENABLED = False

# Override the default request headers:
DEFAULT_REQUEST_HEADERS = {
   # 百度专用头部
   # 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
   # 'Accept-Encoding': 'gzip, deflate, br',
   # 'Accept-Language': 'zh-CN,zh;q=0.9',
   # 'Cache-Control': 'max-age=0',
   # 'Connection': 'keep-alive',
   # 'Cookie': 'BAIDUID=0A60D643AE075F529985162093AA2B82:FG=1; BIDUPSID=0A60D643AE075F529985162093AA2B82; PSTM=1543559037; H_PS_PSSID=1428_21086_27914_27542; BD_UPN=12314753; BDORZ=B490B5EBF6F3CD402E515D22BCDA1598; BDSFRCVID=NekOJeC62GIhetO90QEKhhE_VgOs-7cTH6aoJwuRQFdrjjxq3AY7EG0PqM8g0Ku-O3M3ogKK3gOTH4DF_2uxOjjg8UtVJeC6EG0P3J; H_BDCLCKID_SF=JJADVCIMf-3bfTrnM-r_-DuJ-N_tqI62aKDs2J5oBhcqEIL4QUrsbJ0geH3I0xn32gTd-J3v-5CbHUbSj4QoyR-00RQlKnjB2jbDohjwJh5nhMJlXj7JDMP0qtPeW6Jy523iob3vQpPMshQ3DRoWXPIqbN7P-p5Z5mAqKl0MLIOkbRO4-TFWD5cL3D; H_PS_645EC=17b63aRaCp3%2BbrrPlxpAsL7MuR5vzb%2Faqvyto9e9FSN8D4KdmlEC9AzCnBU; delPer=0; BD_CK_SAM=1; PSINO=6; BDSVRTM=180',
   # 'Host': 'www.baidu.com',
   # 'Upgrade-Insecure-Requests': 1

   #凤凰专用头部
   # 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
   # 'Accept-Encoding': 'gzip, deflate, br',
   # 'Accept-Language': 'zh-CN,zh;q=0.9',
   # 'Cache-Control': 'max-age=0',
   # 'Connection': 'keep-alive',
   # 'Cookie': 'prov=cn020; city=020; weather_city=gd_gz; region_ip=113.66.104.148; region_ver=1.30; ifengRotator_AP544=0; ifengRotator_Ap1527=0; ifengRotator_Ap1139=0; userid=1543800110855_aen3ig5973; ifengWindowCookieNamenews=2; ifengRotator_ArpAdPro_1019=0; ifengRotator_iis3_c=3; ifengRotator_AP573=0; ifengRotator_AP6443=0; ifengRotator_iis3=12; ifengRotator_AP940=0',
   # 'Host': 'news.ifeng.com',
   # 'Upgrade-Insecure-Requests': 1,
   # 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36'
}

# Enable or disable spider middlewares
# See http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
SPIDER_MIDDLEWARES = {
   'iQiYiSpider.middlewares.IqiyispiderSpiderMiddleware': 400,
}

# Enable or disable downloader middlewares
# See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
DOWNLOADER_MIDDLEWARES = {
   # 'iQiYiSpider.middlewares.JavaScriptMiddleware': 543,
   # 'iQiYiSpider.middlewares.ProxyMiddleWare': 125,
}

# Enable or disable extensions
# See http://scrapy.readthedocs.org/en/latest/topics/extensions.html
#EXTENSIONS = {
#    'scrapy.extensions.telnet.TelnetConsole': None,
#}

# Configure item pipelines
# See http://scrapy.readthedocs.org/en/latest/topics/item-pipeline.html
ITEM_PIPELINES = {
   'iQiYiSpider.pipelines.IqiyispiderPipeline': 300,
}

# Enable and configure the AutoThrottle extension (disabled by default)
# See http://doc.scrapy.org/en/latest/topics/autothrottle.html
#AUTOTHROTTLE_ENABLED = True
# The initial download delay
#AUTOTHROTTLE_START_DELAY = 5
# The maximum download delay to be set in case of high latencies
#AUTOTHROTTLE_MAX_DELAY = 60
# The average number of requests Scrapy should be sending in parallel to
# each remote server
#AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
# Enable showing throttling stats for every response received:
#AUTOTHROTTLE_DEBUG = False

# Enable and configure HTTP caching (disabled by default)
# See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
#HTTPCACHE_ENABLED = True
#HTTPCACHE_EXPIRATION_SECS = 0
#HTTPCACHE_DIR = 'httpcache'
#HTTPCACHE_IGNORE_HTTP_CODES = []
#HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'
HTTPERROR_ALLOWED_CODES = [301, 400]
MYSQL_HOST = 'localhost'
MYSQL_DB = 'test'
MYSQL_USER = 'root'
MYSQL_PASSWD = '123456'
MYSQL_CHARSET = 'utf8'
MYSQL_PORT = 22799
